#ifndef SERVERENGINE_H
#define SERVERENGINE_H

#include <string>
#include <iostream>

#include "allegro.h"
#include "alleggl.h"


#include "networkManager.h"
#include "windowManager.h"
#include "msgManager.h"
#include "guiManager.h"
#include "starSystem.h"
#include "configManager.h"


using namespace std;

class serverEngine {


    public:


        serverEngine();
        virtual ~serverEngine();

        void init(string pPath);
        void start(bool debuging);
        bool run(void);
        void stop(void);


    protected:



    private:



        // Memory things
        int memLastKey; // Last Key
        int mouseX, mouseY, mouseZ, memMouseX, memMouseY, memMouseDownX, memMouseDownY, mouseButton; // Maus
        bool flagMausKlick, flagMausMove;



        // Runtime
       long runtimeCount;
        int runtimeFps;
        int runtimeFpsSmooth;



        // Flags
        bool flagDestroy;
        bool flagDebug;
        bool flagChat;


        //
        BITMAP *cursor;


        networkManager *net;
        msgManager *msg;
        guiManager *gui;
        starSystem *starEngine;
        configManager *config;
        windowManager *win;


        // functions
//        timerStart();
        bool timerFlag100;
        bool timerFlag1000;

        void timerTick(void);
        void timerTick100(void);
        void timerTick1000(void);
 static void timerCallback100(void *arg);
 static void timerCallback1000(void *arg);



        void allegroDraw(void);
        void allegroInit(int x, int y, string name);
        void allegroSetMode(int x, int y, string name);


        void inputMouse(int pMouseButton, int pMouseX, int pMouseY, int pMouseZ);
        bool inputKey(int pKey);




};



#endif // SRENGINE_H
